<!DOCTYPE html>
<html style="background: #f6f6f6">
<head lang="en">
<meta charset="UTF-8">
<meta name='apple-touch-fullscreen' content='yes'>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta content="fullscreen=yes,preventMove=no" name="ML-Config">
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="format-detection" content="telephone=no,email=no,address=no"/>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
<title>商品列表</title>
<link rel="stylesheet" href="/style/wei/css/xshop.css?ver=2019041701" />
<link rel="stylesheet" href="/style/css/distribution.css?ver=20191120">
<script type="text/javascript" src="/style/js/jquery-1.12.0.min.js"></script>
<script src="/style/js/style.js"></script>
<script type="text/javascript" src="/style/wei/js/jquery.cookies.js"></script>
<style> 
.foot-menu ul{ height: 1rem;line-height: 1rem; }
.dist-flex{ display: flex;justify-content: space-between;align-items: center; }
.dist-flex b{ width: 0.82rem;height: 0.36rem;font-size: 0.22rem;color: #fff;text-align: center;line-height: 0.36rem;display: inline-block;background: #f75015;border-radius: 0.3rem; }
.dist-flex em{ width: 1.3rem;height: 0.40rem;font-size: 0.22rem;color: #f02c25;text-align: center;line-height: 0.40rem;display: inline-block;background: #fff2e8;}
.dist-main{ margin-bottom: 1.3rem; }
#nav { 
width:80%; 
height: 40px; 
position:fixed;
left:10%;
top:.05rem;
background-color:#0066FF ;  
text-align: center;
border-radius: 50px 50px 50px 50px;
z-index: 999999;
display: none;
}
#nav span{
font-size:14px;
color:#fff;
}
#nav img{
display: block;
width:40px;
height:40x;
border-radius:100%;
overflow: hidden;
}

.more {
    float: left;
    width: 100%;
    height: auto;
    padding: .2rem 0;
    background: #fff;
}
.more .zhekou, .more .sheng {
    margin-right: .2rem;
    float: left;
    width: auto;
    background: #fff;
    border: 1px solid #f7571e;
    color: #f7571e;
    text-align: center;
    padding: 0 .1rem;
    border-radius: 0.12rem;
    font-size: .2rem;
}
.more .share {
    float: left;
    width: 2rem;
    height: .5rem;
    line-height: .5rem;
    text-align: center;
    border:1px solid #c40000;
    color: #c40000;
    font-size: .3rem;
    border-radius: 0 5px;
    margin-left: .2rem;
}
.more .warehouse {
    float: left;
    width: auto;
    margin: 0 .2rem 0 0;
}
.more .warehouse u {
    float: left;
    width: .5rem;
    text-decoration: none;
    border-radius: 0 0 0 5px;
    color: #fff;
    height: 24px;
}
.more .warehouse i {
    float: left;
    width: auto;
    background: #fff;
    border: 1px solid #666;
    color: #666;
    font-size: .25rem;
    height: 24px;
    line-height: 24px;
    padding: 0 .1rem;
    border-radius: 0 5px 0 0;
}
.more .warehouse.baoshui u {
    border: 1px solid #0080FF;
    background: url(/style/new/images/icon_warehouse.png) no-repeat #0080FF;
    background-size: .4rem .4rem;
    background-position: 2px 0;
}
.more .warehouse.baoshui i {
    border: 1px solid #0080FF;
    color: #0080FF;
}
.more .warehouse.bendi u {
    border: 1px solid #00C100;
    background: url(/style/new/images/icon_warehouse.png) no-repeat #00C100;
    background-size: .4rem .4rem;
    background-position: 2px 0;
}
.more .warehouse.bendi i {
    border: 1px solid #00C100;
    color: #00C100;
}
.more .warehouse.haiwai u {
    border: 1px solid #B200B2;
    background: url(/style/new/images/icon_warehouse.png) no-repeat #B200B2;
    background-size: .4rem .4rem;
    background-position: 2px 0;
}
.more .warehouse.haiwai i {
    border: 1px solid #B200B2;
    color: #B200B2;
}
</style> 
</head>
<?php $para = $this->data['para'];?>
<body>
    <div class="dist-topbar">
        <img src="/style/goodslist/d1.png" alt="" class="dist-back" onclick="javascript:history.back(1);">
        <div class="dist-seach">
            <form method="get" class="search-form">
                <input type="text" placeholder="请输入您要搜索的商品关键词" name="keywords" id="_keywords" type="text" value="<?=$this->data['para']['keywords']?>">
                <input  type="hidden" value="<?=$this->data['para']['order']?>"  name="order" id="orders">
                <input  type="hidden" value="<?=$this->data['para']['price']?>"  name="price" id="prices">

                <?php if($para['caid']){?>
                <input  type="hidden" value="<?=$this->data['para']['caid']?>"  name="caid" >
                <?php }?>

                <?php if($para['brand_id']){?>
                <input  type="hidden" value="<?=$para['brand_id']?>"  name="brand_id" >
                <?php }?>

                <?php if($para['goods_ids']){?>
                <input  type="hidden" value="<?=$para['goods_ids']; ?>"  name="goods_ids" id= "goods_ids" >
                <?php }?>

                <input  type="hidden" value="<?=$para['sort_type']; ?>"  name="sort_type" id= "sort_type" >
                <input  type="hidden" value="<?=$para['sort_val']?>"  name="sort_val" id= "sort_val" >

                <img src="/style/goodslist/d2.png" alt="">
            </form>
        </div>
        <span onclick="doSearch()" style="cursor: pointer;">搜索</span>
    </div>
    <div class="dist-main">
        <!-- 筛选 -->
        <ul class="dist-navbar sort-btn">
            <li data-sort='1' class="<?=$para['sort_type'] == 1 ? 'dist-on' : ''?>">
                <i>综合</i>
                <div class="dist-color">
                    <!-- <img src="/style/goodslist/d3.png" alt=""> -->
                </div>
            </li>
            <?php foreach(['折扣','价格','销量'] as $k=>$v):?>
                <li class="<?=$para['sort_type'] == $k+2 ? 'dist-on' : ''?>" data-sort="<?=$k+2?>" data-sort-val="<?=$para['sort_type']==$k+2 ? $para['sort_val']:""?>" style="cursor: pointer;">
                    <i><?=$v?></i>
                    <div class="dist-color dist-img">
                        <?php if($para['sort_type'] == $k+2):?>
                            <img src="/style/goodslist/<?=$para['sort_val']==1?"d4_on":"d4"?>.png" alt="">
                            <img src="/style/goodslist/<?=$para['sort_val']==2?"d5_on":"d5"?>.png" alt="">
                        <?php else:?>
                            <img src="/style/goodslist/d4.png" alt="">
                            <img src="/style/goodslist/d5.png" alt="">
                        <?php endif;?>
                    </div>
                </li>
            <?php endforeach;?>
        </ul>

        <!-- 商品列表 -->
        <ul class="dist-view">
            <?php 
                if($this->data['data']): foreach($this->data['data'] as $r): 
                    $link = '/index/goodsdetail?goods_id='.$r['goods_id'];
                    $sp = explode(".", $r['shop_price']);
            ?>
                <li>
                    <a href="<?=$link?>">
                        <?php if (!empty($r['thumb_docid'])): ?>
                            <img class="lazyimg" data-original="<?=$r['thumb_docid']?>" src="/style/images/lazycover.jpg"  />
                        <?php else:?>
                            <img src="/style/new/images/home/xihuan-pic1.png" />
                        <?php endif; ?>
                    </a>
                    <div class="dist-view-right">
                        <h3><a href="<?=$link?>"><?=$r['goods_name'];?></a></h3>
                        <div class="d-count">
                            <div class="more">
                                <?php
                                if($r['price_me'] >0)
                                {
                                    echo '<div class="zhekou">返'.($r['price_me'] * 1).'</div>';
                                }

                                if($r['coupon_price'] >0)
                                {
                                    echo  '<div class="sheng">抵券'.$r['coupon_price'].'</div>';
                                }
                                ?>

                            </div>

                            <!--<h4>￥<?/*=$r['market_price']*/?></h4>-->
                        </div>
                        <div class="d-flex">
                            <i>￥</i>
                            <em><?=$sp[0]?></em>
                            <i>.<?=$sp[1]?></i>
                        </div>

                      <!--  <p><i>已销<?/*=$r['sales_count'];*/?>笔</i><i>库存<?/*=$r['goods_number'];*/?>件</i></p>-->
               <!--         <div class="dist-flex">
                            <?php /*if($r['market_price'] > $r['shop_price']):*/?>
                                <b><?/*=(number_format($r['shop_price'] / $r['market_price'],2,".","") * 10)*/?>折</b>
                                <em>省 <?/*=number_format($r['market_price'] - $r['shop_price'],2,".","")*/?></em>
                            <?php /*endif;*/?>
                        </div>-->


                    </div>
                </li>
            <?php endforeach;endif;?>
        </ul>
    </div>
    <div class="foot-menu">
        <ul class="clearfix">
            <li class="on"><a href="/"><i class="ico-7"></i><span>首页</span></a></li>
            <li ><a href="/rcm"><i class="ico-1"></i><span>商城</span></a></li>
            <li><a href="/cart/cart"><i class="ico-5"></i><span>购物车</span></a></li>
            <li><a href="/college"><i class="ico-8"></i><span>商学院</span></a></li>
            <li><a href="/user/index"><i class="ico-4"></i><span>我的</span></a></li>
        </ul>
    </div>
</body>
<script type="text/javascript" src="/style/new/js/jquery.lazyload.js"></script>
<script type="text/javascript">
    $(".lazyimg").lazyload({
      threshold : 200,
      placeholder : "/style/images/lazycover.jpg",
      failurelimit : 4
    });

    function doSearch(){
        $(".search-form").submit();
    } 

    $(".sort-btn").on("click", "li", function(){
        var sort_type = $(this).data('sort');

        if(sort_type==1 && $(this).hasClass("dist-on")) {
            return;
        }

        $("#sort_type").val(sort_type);
        var sort_val = parseInt($(this).data('sort-val'));
        sort_val = sort_val == 1 ? 2 : 1;
        $("#sort_val").val(sort_val);
        
        doSearch();
    });
</script>

<?php if($this->JSAPI): ?>
    <!-- 微信分享代码 -->

    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <script>
    wx.config({
      appId: '<?=$this->JSAPI['appId'];?>',
      timestamp: '<?=$this->JSAPI['timestamp'];?>',
      nonceStr: '<?=$this->JSAPI['nonceStr'];?>',
      signature: '<?=$this->JSAPI['signature'];?>',
      jsApiList: [
        'onMenuShareTimeline', //分享到朋友圈
        'onMenuShareAppMessage' //分享给朋友
      ]
    });
    wx.checkJsApi({
        jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
        success: function(res) {
        // 以键值对的形式返回，可用的api值true，不可用为false
        // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
        // alert(res);
        }
    });
    wx.ready(function () {
      wx.onMenuShareAppMessage({

        title: '<?= $this->name; ?> - 西海良品', // 分享标题
        desc: '绿色富硒、好吃不贵的优质农产品，自购省钱、分享赚钱，欢迎加盟...', // 分享描述
        link: '<?=$this->JSAPI['url'];?>', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
        imgUrl: 'http://<?=$_SERVER['HTTP_HOST'];?>/style/wei/images/tuijian/tj_logo_big2.jpg', // 分享图标
        type: 'link', // 分享类型,music、video或link，不填默认为link
        dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
        success: function () {
        // 用户确认分享后执行的回调函数
        },
        cancel: function () {
        // 用户取消分享后执行的回调函数
        }
      });
      
        // 分享到朋友圈
        wx.onMenuShareTimeline({
          title: '<?= $this->name; ?> - 西海良品', // 分享标题
          link: '<?=$this->JSAPI['url'];?>', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
          imgUrl: 'http://<?=$_SERVER['HTTP_HOST'];?>/style/wei/images/tuijian/tj_logo_big2.jpg', // 分享图标
          success: function () {
          // 用户确认分享后执行的回调函数
        },
        cancel: function () {
          // 用户取消分享后执行的回调函数
          }
      });  

    });
    </script>
<?php endif; ?>
</html>